package com.zoo.wuhua.config;

//import org.apache.catalina.Context;
//import org.apache.catalina.connector.Connector;
//import org.apache.tomcat.util.descriptor.web.SecurityCollection;
//import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
//import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
//import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <b>将HTTP请求重定向为HTTPS请求</b><br>
 *
 * @author zhangli7@yusys.com.cn
 * @since 2019年10月29日 下午12:00:28
 */
@Configuration
public class HttpRedirectConfig {

	// @Bean
	// TomcatServletWebServerFactory factory() {
	// TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() {
	// @Override
	// protected void postProcessContext(Context context) {
	// SecurityConstraint constraint = new SecurityConstraint();
	// constraint.setUserConstraint("CONFIDENTIAL");
	// SecurityCollection collection = new SecurityCollection();
	// collection.addPattern("/*");
	// constraint.addCollection(collection);
	// context.addConstraint(constraint);
	// }
	// };
	// factory.addAdditionalTomcatConnectors(createTomcatConnectors());
	// return factory;
	// }
	//
	// private Connector createTomcatConnectors() {
	// Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
	// connector.setScheme("http");
	// connector.setPort(7778);
	// connector.setSecure(false);
	// connector.setRedirectPort(7777);
	// return connector;
	// }

}
